package jiinn.services;

import java.util.List;

import jiinn.interfaces.MemberDAO;
import jiinn.interfaces.MemberService;
import jiinn.models.MemberVO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

@Service("memberService")
public class MemberServiceImpl implements MemberService {

	@Autowired
	private MemberDAO memberDAO;
	
	@Override
	public String newMember(MemberVO m) {
		String result = "join/joinok";
		if (memberDAO.insertMember(m)) {
			result = "redirect:/join/joinok.pen";
		}
		return result;
	}

	@Override
	public List<MemberVO> readMember() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public MemberVO readOneMember(String mno) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String modifyMember(String mno) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String removeMember(String mno) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String joinChkMember(MemberVO m) {
		String result = "redirect:/join/joinalready.pen";
		if (memberDAO.joinChkMember(m)==0) {
			result = "redirect:/join/joininfo.pen";
		}
		return result;
	}

	@Override
	public String checkUid(String uid) {
		String result = "n";
		if (memberDAO.checkUid(uid)==0)
			result = "y";
		return result;
	}

	@Override
	public String loginMember(MemberVO m) {
		return memberDAO.loginMember(m);
	}

}
